<script>
import './tree-grid.less'
import funTool from '@/libs/funTool'
import subtreegrid from './component/sub-tree-grid'
import renderCol from './component/renderCol'

export default {
  props: ['columns', 'data'],
  data() {
    return {}
  },
  components: {
    subtreegrid: subtreegrid,
  },
  render(h) {
    return (
      <div class="ivu-table-wrapper">
        <div class="ivu-table ivu-table-border">
          <table cellspacing="0" width="100%" cellpadding="0" border="0">
            <thead class="ivu-table-header">
              <tr>
                {this.columns.map((col) => {
                  let tdStyle = { 'text-align': 'center' }
                  if (col.width) {
                    tdStyle.width = col.width + 'px'
                  }
                  return (
                    <th style={tdStyle}>
                      <div class="ivu-table-cell">
                        <span if> {col.title}</span>
                      </div>
                    </th>
                  )
                })}
              </tr>
            </thead>
            <tbody class="ivu-table-tbody ">
              <tr class="ivu-table-row">
                <td colspan={this.columns.length} style="border: none;">
                  <subtreegrid columns={this.columns} data={this.data} children={this.children} grade={1} />
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    )
  },
  methods: {},
  mounted() {},
}
</script>
